import 'package:flutter/material.dart';
import 'package:ninetyfour/l10n/app_localizations.dart';

class AuthTopView extends StatelessWidget {
  final VoidCallback onBack;
  final VoidCallback onHelp;
  final int loginType;
  
  const AuthTopView({
    super.key,
    required this.onBack,
    required this.onHelp,
    required this.loginType,
  });

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 280,
      child: Stack(
        children: [
          // 背景图片
          Positioned.fill(
            child: Image.asset(
              'assets/images/login_bg2.png',
              fit: BoxFit.cover,
            ),
          ),
          
          // 返回按钮
          Positioned(
            left: 20,
            top: MediaQuery.of(context).padding.top,
            child: IconButton(
              icon: Image.asset('assets/images/leftpush.png', width: 26, height: 26),
              onPressed: onBack,
            ),
          ),
          
          // 客服按钮
          Positioned(
            right: 20,
            top: MediaQuery.of(context).padding.top,
            child: TextButton(
              onPressed: onHelp,
              child: Text(
                AppLocalizations.of(context)!.haveAProblem,
                style: const TextStyle(
                  color: Colors.white,
                  fontSize: 15,
                ),
              ),
            ),
          ),
          
          // 用户名
          Positioned(
            top: MediaQuery.of(context).padding.top + 60,
            left: 0,
            right: 0,
            child: Text(
              loginType == 0 ? AppLocalizations.of(context)!.googleSign : 
                loginType == 1 ? AppLocalizations.of(context)!.lineSign : 
                AppLocalizations.of(context)!.appleSign,
              textAlign: TextAlign.center,
              style: const TextStyle(
                color: Colors.white,
                fontSize: 17,
                fontWeight: FontWeight.w600,
              ),
            ),
          ),
          
          // 图标1
          Positioned(
            top: MediaQuery.of(context).padding.top + 110,
            left: MediaQuery.of(context).size.width / 3 - 25,
            child: Image.asset(
              loginType == 0 ? 'assets/images/google.png' :
                loginType == 1? 'assets/images/line.png' :
                'assets/images/AppleID.png',
              width: 50,
              height: 50,
            ),
          ),
          
          // 中间图标
          Positioned(
            top: MediaQuery.of(context).padding.top + 125,
            left: MediaQuery.of(context).size.width / 2 - 15,
            child: Image.asset(
              'assets/images/login_icon2.png',
              width: 30,
              height: 20,
            ),
          ),
          
          // 图标2
          Positioned(
            top: MediaQuery.of(context).padding.top + 110,
            left: MediaQuery.of(context).size.width * 2 / 3 - 25,
            child: Image.asset(
              'assets/images/login_icon3.png',
              width: 50,
              height: 50,
            ),
          ),
        ],
      ),
    );
  }
}